package com.mm.service;/**
 * @author wdx
 * @create 2021-09-03 15:26
 */

import com.spring.BeanPostProcessor;
import com.spring.Component;

/**
 * @author wdx
 * @date 2021年09月03日 15:26
 */
@Component
public class MmBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        System.out.println("初始化前");
        if (beanName.equals("userService")) {
            ((UserService)bean).setName("我好累");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("初始化后");
        return bean;
    }
}
